#!/bin/bash
#author:| leman
#time:| 2020-1-7

#before install
rpm_install(){
    yum -y install gcc gcc-c++;
    yum -y install libxml2-devel libxml2 \ 
    libxml2-devel curl curl-devel  libjpeg-devel \
    libpng-devel freetype-devel libxslt-devel;
}

config_php(){
    wget  http://cn.php.net/distributions/php-5.6.21.tar.gz;
    tar -xf php-5.6.21.tar.gz  -C php-5.6.21;
    cd cd php-5.6.21;
    ./configure  \
    --prefix=/usr/local/php-5.6.21 \
    --with-config-file-path=/data/php-5.6.21/etc \
    --enable-mbstring \
    --enable-sockets \
    --enable-fpm \
    --with-mysqli \
    --enable-mysqlnd \
    --with-pdo-mysql=mysqlnd \
    --with-freetype-dir \
    --with-jpeg-dir \
    --with-png-dir \
    --with-zlib \
    --enable-xml \
    --disable-rpath \
    --enable-inline-optimization \
    --with-curl \
    --enable-mbregex \
    --with-gd \
    --enable-bcmath \
    --enable-gd-native-ttf \
    --with-openssl \
    --enable-zip \
    --enable-short-tags \
    --enable-static \
    --with-fpm-user=nginx \
    --with-fpm-group=nginx 

    make && make install;
    ln -s /usr/local/php-5.6.21 /usr/local/php;
}

rpm_install
config_php